package com.tiger.web;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.stereotype.Component;

@Component("webClientManger")
public class WebClientManager {
	private Map<String, WebClient> clients = new ConcurrentHashMap<>();
	
	public void put(String id, WebClient client) {
		clients.put(id, client);
	}
	
	public void remove(String id) {
		clients.remove(id);
	}
	
	public WebClient get(String id) {
		return clients.get(id);
	}

	public static interface WebClient {
		void sendMsg(String msg);
		
		void close();
	}

	public int size() {
		return clients.size();
	}
	
}
